package com.peaker.advertisingpro.view

import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.Window
import android.view.WindowManager
import com.peaker.advertisingpro.R
import com.peaker.advertisingpro.activity.LoginActivity
import kotlinx.android.synthetic.main.qiyedialog.*

/**
 *  @ 作者 CODE_LYF
 *  @ 时间   2021/3/18.
 *  代码人生
 */
class QiyeDialog(context: Context) : Dialog(context), View.OnClickListener {

    init {
        window?.requestFeature(Window.FEATURE_NO_TITLE)
        window?.setBackgroundDrawableResource(android.R.color.transparent)
    }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.qiyedialog)
//        ownerActivity=context as Activity
        setCanceledOnTouchOutside(false)
        btn_back.setOnClickListener(this)
        qiye_login_btn.setOnClickListener(this)

        window?.setLayout(
            WindowManager.LayoutParams.MATCH_PARENT,
            WindowManager.LayoutParams.MATCH_PARENT
        )

    }

    override fun onClick(v: View?) {
        when (v!!.id) {
            R.id.btn_back -> {
                dismiss()
            }
            R.id.qiye_login_btn -> {
                var intent = Intent(context, LoginActivity::class.java)
                context.startActivity(intent)
                dismiss()
            }
        }
    }
}